******************************************************************* * * * (C) Copyright International Business Machines Corporation 1993. * * All rights Reserved. * * * ******************************************************************* ALPHA1 V1.7 Lionel de Lambert - Iunius MMDCCXLIII AUC IBM United Kingdom Laboratories Ltd. 21 September 1994 This document describes the installation, function and commands of the ALPHA1 Software analysis programme which runs under the OS/2 (v1.3 & v2.x) operating systems. The languages supported are :- 370 and 386 assembler, PASCAL(Ada), PL/X(PL/I, REXX), C and FORTRAN. Introduction. ============= This programme may be of interest to those people who examine 370, 386 assembler, PASCAL(Ada), PL/AS(PL/I, REXX), C, FORTRAN etc. under OS/2. This programme was written together with the CMS programme ANALYSE in order to establish some of the praecognita for the CICS restructure project. This programme will provide basic browse functions for all files with a record size <=256 as well as highlighting specified keywords and allowing user defined Marker references and flow lines, and for language files such as 370 & 386 Assemble, PASCAL, PL/AS, C, FORTRAN etc. ALPHA will also draw branch flow lines from 'Jump/GOTO' instructions to labels in the same window, will display the programme call structure, and expand the procedure call in a secondary window. The programme is written in PASCAL and MASM for OS/2 using Presentation Manager calls. Installation ============ The minimum requirement is to transfer the binary file 'ALPHA1.EXE' to a directory on your PS/2. If you want different colours, fonts etc. you can copy the text file 'ALPHA.PRF' to the PS/2 and edit the file. You can also install the 'Alpha' fonts by transferring the binary file 'ALPHA.FON' to the PS/2 and using the 'Add font' command of the Installation menu on the 'Control Panel' on OS/2 V1.3. On OS/2 V2.x select 'System Setup' from 'OS/2 System' and use 'Add' in the 'Edit font' of the 'Font Palette'. If you wish to access files from the host then you should also install the 'Transfer_pgm' (ALMCOPY). You can send commands to the host if you also install a 'Command_pgm' (OS2CMD). Starting up Alpha The syntax for starting up the Alpha programme is :- [C:\] ALPHA1

> Where the option /m may be specified to cause the programme to be started minimised. This is intended for use in the 'STARTUP.CMD' file as an alternative to having the programme in the "Group - main" window, e.g. START ALPHA1 /p /m The option /p may be specified to cause the file of initial values of colours, font etc. to be read. The default file name for this profile is 'ALPHA.PRF'. This file may be used to set alternative start up values such as the keyword colours. If a file name is not supplied on the OS/2 command line then the first display will ask for the file name to be browsed. The Enter key or Enter button should be used to terminate the string, e.g. C:\WORK\TEST.A37 On OS/2 V1.3 if Alpha is minimised or active with or without a file allocated and the file manager window is active then a selected file may be moved from the file manager window by dragging mouse button 2 and releasing it over the ê icon or main window. This will cause the new file to be allocated. On OS/2 V2.x a file from a Drives window may be dropped on to the Alpha Icon of the unstarted programme. note If the window fails to appear the error, WinGetLastError, is written to the OUTPUT device. This should be directed to a printer or file e.g. ALPHA >PRN | >file_name Description =========== This programme may be used to browse any file with a record size <=256 and may also be used with language files such as :- 370, 386 assembler, PASCAL(Ada), PL/AS(PL/I, REXX), C, and FORTRAN programmes etc. on a PS/2 under OS/2 to help in analysing their structure. The basic browse functions are :- 1) Home - Move to top of file 2) End - Move to end of file 3) Page_up - scroll up 1 screen 4) Page_down - scroll down 1 screen 5) F7 - scroll up 1/2 screen 6) F8 - scroll down 1/2 screen 7) F19 (Shift+F7) - scroll left 1/2 screen 8) F20 (Shift+F8) - scroll right 1/2 screen 9) The Horizontal and Vertical scroll bars. The mouse button 1 when pressed will isolate the addressed string using ' ', ',', '+' etc. as separators, and highlight it and all references in the window or as the file is browsed. In Locate mode if mouse button 1 is pressed twice (double clicked) then the isolated string will become a search argument. If mouse button 2 is pressed once (clicked) then the next occurrence of the search argument will be located. If mouse button 2 is double clicked then the search will start at the top of the file. In Expand mode if mouse button 1 is double clicked then the search string is assumed to be a label or procedure name and a second window is opened with the procedure code provided the label/routine name can be found. Search commands may be issued from the command window, which may be invoked by the F6 key or the system menu icon Alpha. When the main window is displayed keywords which are associated with the file extension will be highlighted using the colours specified in the profile. Note Up to 128 language keywords may be specified with their corresponding colour and the length of the record to be scanned. Only the first 16 keywords on the line will be highlighted and the search order is the order specified in the profile. The keyword must be <=12 characters. The File_type keyword in the profile may be used to introduce extra file types but the first 6 types are assumed to refer to :- 370 assembler, 386 assembler, PASCAL, PL/AS, C, and FORTRAN in that order. With Flow on for language files branch flow lines will be drawn from 'Branch/GOTO' instructions to labels in the same window. If the profile specifies Read_file=Yes, the default, then the file may be browsed as soon as the window is opened, performance then improves once the file is read in. Note Only the first 256 characters of a record are read. Once the file is read in there is an internal switch over. If a locate etc. was in progress at the time of the switch over the window may not display the line found; it may be necessary to repeat the command e.g. F5. If the profile specifies Read_file=No then only 120 records from the file are read in to storage and scrolling takes place within this buffer unless F4+Ctrl is pressed when the whole file is read in to memory asynchronously. As the file is scrolled up/down extra pages are read in to the buffer. The affect is that on scrolling upwards, after the window is displayed, there may be a pause (hour glass symbol) while extra data is read in. Small parts (<=window size) of the file may be remembered and redisplayed by using the Clipboard function. Drag the mouse with button 1 down over the lines to be saved and press Ctrl+Insert to save the highlighted lines. To redisplay the saved lines press Shift+Insert. The lines are displayed from the cursor position onwards. The highlighted records may be printed on LPT1 by pressing Insert+Alt. Function keys ============= The following keys are effective for the programme:- Mouse button 1 will isolate and highlight the text. If button 1 is pressed twice then the highlighted string may then be used as a search argument by button 2. Mouse button 2 will scan from the current position to the end of file for the locate string, i.e. the string isolated by button 1 or by use of a locate command from the command window (F6). If the mouse button 2 is pressed twice then the scan will start from the top of the file. F1 is the help key. F1+Alt will display/hide the current status. {The statement number is displayed in the TITLE bar. R indicates that the file is being read in to memory, S indicates that the programme structure is being recorded.} F2 will change the font. The System Monospaced font is the default font, unless the Alpha font is installed. F3 will terminate programme. F4 will allocate a new file F4+Ctrl will read the currently assigned file in to memory. Note A separate thread is attached to read in the file whilst the file may continue to be browsed within the 120 record buffer. The scrolling of the file will be much faster but there may be some degradation of performance while the file is read in to store. A maximum of 21,844 records can be read in if there is enough memory available. When the file is read in there is a beep of 1760HZ to indicate that the file has been read and one of 880HZ to idicate that the structure has been recorded, provided that "Quiet=No" is specified in the profile. F5 will repeat the previous command F6 will issue a command. Note This window may also be created from the system menu icon Alpha. A child window is created in to which may be typed the command. F7 scroll up 1/2 screen. F8 scroll down 1/2 screen. F9 switch on/off comment suppression. A sequence of blank or comment lines will be compressed to a single line of  provided that he file is read in. The comment lines must begin with characters specified in Comment_start and end with the characters specified in Comment_end. F10 not used. F11 not used. F12 will move the mouse button 1 focus line {The line on which mouse button 1 was last pressed.} to the centre of screen. F12+Ctrl will switch on/off the scale line in the centre of the window. F13 (shift+F1) will display the programme structure. F14 (shift+F2) will change the text colours. F17 (shift+F5) will locate the next Marker. F19 (Shift+F7) will scroll left 1/2 line. F20 (shift+F8) will scroll right 1/2 line. F24 (shift+F12) will reset the horizontal scroll, clear line markers etc. Page_Up will scroll up one page. Page_Down will scroll down one page. Home key will move to top of file. End key will move to end of file. Insert+Ctrl will place mouse Button 1 drag area in Clipboard. Insert+Shift will copy Clipboard text to mouse Button 1 position - cursor. Insert+Alt will write the highlighted records to LPT1. Delete+Ctrl will remove the highlighted records, mouse button 1 display area, from the window display. Delete+Shift will restore the deleted records. The Up & Down arrow keys will move the cursor. The scroll arrows, slider etc. and Page up or Page down keys may be used for browsing. Note If the mouse button 1 is kept depressed on the scroll bar arrows then the lines or characters will scroll until the button is released. If the file is not read in then the file size is estimated by adding 1000 every time the internal array is filled. In this case the slider may move to the end of the vertical scroll bar before end_of_file is reached and then move up. Enter key will terminate an input string or refresh the screen. Help window ----------- This window may be invoked by the F1 key or the Help button on the command window. The window may be scrolled by :- Page_up - scroll up 1 screen Page_down - scroll down 1 screen Home - scroll to the top of the Help data End - scroll to the end of the Help data F7 - scroll up 1/2 screen F8 - scroll down 1/2 screen The Page_Up key word at the bottom of the window will scroll up 1 screen if selected by mouse button 1. The Page_Down key word at the bottom of the window will scroll down 1 screen if selected by mouse button 1. The OS/2 help file, ALPHA.HLP, may be accessed by selecting '?' from the system menu. The Help window may be cancelled by F3, the Cancel button or by Enter. Allocate window --------------- The File Allocate window will be created by the F4 key or from the Allocate menu item of the command window. The file may be selected from the List box or typed in to the Entry box. The drive may be changed by selecting ¨aà from the List box or typing the drive letter followed by a ':' e.g. 'a:' in the Entry box. The Path may be changed by selecting a directory name from the List box or by typing the path name in the Entry box e.g. 'C:\WORK'. The COMBO box will hold the last three allocate texts which have been entered. A host file may be received and allocated by entering '>H:fn ft fm PC_file_name'; this string is passed to Transfer_pgm (ALMCOPY) {without the '>' and with '/Q' appended} which must be installed on the PS/2. If Transfer_pgm fails the return code is displayed in red and the Entry text is left to be edited. If the requested file can not be allocated then the allocate window together with an error message will be displayed. A host command may be executed by entering 'n - scroll right n characters :n - go to record n / - Search for string, not case dependent, from the current position in the file. " - Search for string, as typed, from the current position in the file ' - Search for string, as typed, from the current position in the file but only in column 1 (s-e)>file_name - will copy records from the current file starting at s and ending with e to the file file_name. file_name may be 'LPT2' etc., an existing file or a new file. If the end record number is '*' then the file is copied to end-of-file. (s-e)- - will remove the records from the window.  will cycle through the last 6 commands. The Delete|Backspace key will delete a character from the input text. If the first character is invalid then the line will be filled red until it is deleted. F3 or ENTER will close the window and enter the command. The cancel button will remove the window; only this child window will receive input until it is terminated. The Flow button will switch on/off the drawing of flow lines. These lines are drawn for language files from 'Branch/GOTO' instructions to labels within the window. The Expand/Locate button will switch on/off the label expansion. The isolated label is expanded by locating the routine and opening a second window containing the code. The mouse button 1 must be pressed twice (double clicked) to cause the label to be located. A depth of 8 expand windows is allowed, and each window may be scrolled using the scroll bar, Page_Up, Page_Down, etc. The file must be read in to storage to use this facility. The Expand window may be closed by F3 or the CALL menu item when the main window will remain at the CALL. If the Routine menu is clicked then the main window will scroll to the expand text, i.e. the called code line may be passed back to the higher level window. The Locate menu or F6 will perform a case sensitive forward search from the current line+1. F5 will repeat the previous locate. If Button 2 is double clicked after moving to the expanded label then the window will be moved back to the previous line, i.e. return to point of call. The label searched for is succeeded by ":" for PLS and preceded by "FUNCTION" or "PROCEDURE" in PASCAL. The label searched for is preceded by "char", "extern", "far", "int", "long", "pascal", "pointer", "short", "static" or "void" if the language type is C. The label searched for is preceded by "FUNCTION" or "SUBROUTINE" if the language type is FORTRAN. (The language keywords may be specified by the Language_operator keyword in the profile. The C language values, language 5, may be set by the Precedent_C keyword in the profile.) The Mark button will switch on/off the drawing of user flow lines defined by the mouse button 1, or the setting of a marker. Up to 16 user lines or markers may be associated with the file. If mouse button 1 is double clicked then a marker will be associated with the line. If mouse button 1 is pressed once then it will delimit the ends of a flow line. The markers or flow lines remain associated with the record until F24 (Shift+F12) is pressed. The markers enable places within the file to be remembered and recalled by (Shift+F5). The Options menu may be selected to change the state of the following options :- Transient Options - reset when a new file is allocated. Comment Suppression - replace a block of comment lines by one highlighted line of . Scale - place a scale line in the middle of the window. Statement_# - will display the current line number in the TITLE bar. Status - indicate in the top left of the window the current status of file reading etc. Permanent Options - remain set when a new file is allocated. Quiet - suppress the beep which indicates that the file is read in to storage. Read_file_when_allocated - when the file has been allocated read it in to storage by attaching a subtask. The file may be browsed whilst this is in progress but the reading of the file in to storage will be slower. Record_structure - For language files this will cause the recording of the calling structure when the file has been read. Tab - recognize tab characters, X'09', and skip to n*8. Proportional - use the font spacing for writing the characters rather than the character size; this will allow proportional fonts to be used however these are not suitable for displaying code. Keyword - allow or suppress the keyword highlighting. The Allocate menu will create the Allocate window The Structure menu may be used to display the call structure for 370, 386 assembler, PASCAL, PL/AS, C and FORTRAN programmes provided that the Record_structure option is effective when the file is read in. For 370 assembler the structure is based on BAL, BAS, DFHSTACK, for 386 assembler CALL, PROC instructions, for PASCAL PROCEDURE, FUNCTION, keywords, for C char, extern, far, int, long, pascal, pointer, short, static or void keywords, for PL/AS PROC, CALL, keywords, and for FORTRAN FUNCTION, SUBROUTINE, CALL keywords {Labels Ÿ27 characters are ignored}. The C language keywords may be specified by the Precedent_C keyword in the profile, and the operators for the other languages by the Language_operator keyword. If an entry is selected from the Programme Structure List Box then the main window is scrolled to that line. The Print button may be used to print the contents of the List box on LPT1. The Font menu may be used to dynamically change the font and character size; the change is not saved in the profile. The Colour menu may be used to dynamically change the text colours. The language keyword colours must be specified in the profile. FONTs ----- You can specify the initial/default font in the profile by using the Font keyword in the profile, or you can change the font dynamically by invoking the Font window. You can use the System Monospaced, Helvetica, Roman and Courier fonts but the Courier font and the System Monospaced are the only monospaced fonts supplied with OS/2 V1.3. A monospaced font with point sizes 8,9,10,11,16 & 20 is supplied with the ALPHA PACKAGE, which may also be used. The fonts are then requested by specifying Font="Alpha",(10) etc. in the profile. The font type or face_name and size may be selected by the Font and Character_size keywords in the profile. If a profile is not supplied then the "Alpha",(10) font will be used if it is installed and a character_size of (8,14) else the "System Monospaced",(10) font will be used and a character_size of (8,16). Outline fonts are not selectable. If the point size is not specified then the font is selected by using the Character_size. Point sizes (1/72") are :- Courier (8,10,12), Roman (8,10,12,14,18,24), Helvetica (8,10,12,14,18,24), System (8,10,12, {8x8, 8x16,9x20), "Alpha" (8{8x12},9{9x10},10{8x14},11{11x12},16{12x16},20{12x20}). If the point size is specified but an image font does not exist for this nominal point size then the outline font, if available, will be used and scaled by the Character_size. The font may be requested by face_name, e.g. Font="Alpha",(8). Profile ------- A profile may be specified defining the following keyword values :- {Colours may take the values :- BLUE, DARKCYAN, BLACK, DARKBLUE, DARKPINK, DARKGRAY, DARKRED, DARKGREEN, BROWN, CYAN, RED, GREEN ,PINK, YELLOW, PALEGRAY, DEFAULT, WHITE} Text_colour specifies the colour of the window text. Highlight_colour is used for the isolate function of mouse button 1. Locate_colour is used for the argument for the locate function. Comment_colour - the first comment_colour is used for comment lines beginning, /*, {, *, ;, C and for the 'scale' background. The second comment_colour is used for the compressed comment line and for the Clipboard highlight. Branch_colour is used for 370, 386 branch instructions. Expand_colour is used for the text in the label expansion window. Back_ground is use to specify the main window background colour. File_type specifies the File types to be recognized. The string must be ²64 characters and terminated by a comma. The first 6 types are used for :- 1 370 assembler 2 386 assembler 3 PASCAL, (Ada) 4 PL/S, PL/AS, PL/I etc., (REXX) 5 C 6 FORTRAN For REXX files use :- "A37,ASM,PAS,CMD,C,FOR," and replace the PLS entries under the Language_colour keyword. For Ada files use :- "A37,ASM,ADA,PLS,C,FOR," and replace the PAS entries under the Language_colour keyword. Comment_start specifies the first two characters of the start of a comment. The string must be ²12 characters. The 6 pairs are used for :- 1 370 assembler 2 386 assembler 3 PASCAL, for Ada specify Comment_start="* ; --/*/*C " 4 PL/S, PL/AS etc. 5 C 6 FORTRAN Comment_end specifies the last two characters of the end of a comment. The string must be ²12 characters. The 6 pairs are used as for Comment_start Precedent_C specifies the C language procedure keywords. The string must be <=64 characters and terminated by a comma. E.g. Precedent_C="char,extern,far,int,long,pascal,pointer,short,static,void," Language_colour defines the highlight colours for key words. Up to 128 entries may be defined as follows :- file_type,key_word,colour,scan_length and are terminated by .END, invalid entries are ignored. The keywords must be <=12 characters. Language_operator defines the operator keywords for each language. The second value indicates how to process the keyword, viz. < or > indicate the scan direction from the keyword to locate the label, 'P' or 'C' indicates that the keyword specifies an entry point or call, ':' indicates that the label will be followed by a colon, '2' indicates that the second label following a ',' is to be used. Up to 32 entries may be defined as follows :- file_type,<º>CºP[:][2],keyword and are terminated by '.END', invalid entries are ignored. The keywords must be <=12 characters. The C-language procedure values are supplied on the Precedent_C keyword. Font may take the values :- Courier|System|Helvetica|Roman|Alpha<,Bold|Italic><,(Point_size)> or a face name may be specified e.g. Font="Alpha",(10) Character_size specifies the (width,height) of the characters. The character width is used to select the size of the Font if the point size is not specified on the "Font" keyword. Read_file takes the value Yes|No and specifies whether the file is to be read in after allocation. Flow takes the value On|Off and specifies whether to draw flow lines from branch statements to labels. Expand takes the value On|Off and specifies that Expand mode will be effective once the file is read in. Marker takes the value On|Off and specifies whether mouse button 1 will define marker values. Language takes the values :- *<,Language> {The '*' implies determine the language from the file suffix}. If a Language is also given then this will be the default if the file type can not be found in "File_type", e.g. Language=*,PAS. For PL/I, REXX use Language=PLS etc. A37 - 370 assemble ASM - 386 macro assemble PAS - Pascal (Ada) PLS - PL/S or PL/AS etc. (PL/I, REXX) C - C language FOR - FORTRAN Default_chr specifies the default character width and height used for scaling the Allocate and Command dialogue boxes. The default value is (10,16), for 8515, 8516 screens a default value of (14,20) is used. Window specifies the initial window position. If no profile is specified then Window=(0,4h,63.5w,26h) {(0,120,1020,650) for 8515/8516 screens} is assumed where w and h are the Default_chr width & height. Quiet will suppress the beep on completion of file read. Record_structure will record the CALL structure for 370 & 386 assembler, PASCAL, PL/AS, C and FORTRAN programmes, as the file is read in to memory. Tab will use X'09' as the tab character to move to column n*8 when file is read. Proportional will use the Font character spacing rather than the Character width to place the characters. Keyword will highlight the specified keywords. Statement_number sets the display of the statement number On|Off. Command_pgm specifies the programme name invoked by <. Transfer_pgm specifies the programme name invoked by >. Alpha has within it (hard coded) routines which understand certain language features e.g. 370 Assembler labels start in start in column 1, procedures are invoked by BAL, BAS etc. and PASCAL procedures are preceded by FUNCTION or PROCEDURE etc.. The keywords and their attributes may be set by the Language_operator keyword in the profile. There are 6 such languages 'understood' by Alpha, viz. :- 1 370 Assembler 2 386 Assembler 3 PASCAL (Ada) 4 PL/AS (PL/I, REXX) 5 C 6 FORTRAN Because Ada is similar to PASCAL and PL/I & REXX are similar to PL/AS, in respect to procedure calls etc., you can also analyse these languages by pretending they are type 3 & 4 respectively. However, you can interpret any language/file type (use the highlighting facility) by suppling extra definitions in a profile which is specified as a parameter to Alpha e.g. START ALPHA1 /p profile_name A sample profile (ALPHA.PRF) is provided in the package, which includes comments explaining the use of the keywords. This may be edited to change/add a file extension, highlighting and programme structure by modifying the following keywords :- File_type - list of file extensions up to 32 characters Comment_start - list of comment start character pairs (blank is ignored) up to 12 characters. Comment_end - list of comment end character pairs (blank is ignored) up to 12 characters. Language_colour - list of keyword definitions file_type,keyword,colour,maximum scan length Precedent_C - list of procedure keywords for language 5 which precede a procedure definition, up to 64 charcaters. Language_operator - list of operator definitions file_type,attributes,keyword e.g. to add language XYZ with a routine call 'ICALL routine_name' and a structure similar to PL/S File_type="A37,ASM,PAS,XYZ,C," Language_colour XYZ,ICALL,DARKGREEN,72 XYZ,Next_key ,RED,72 .END Language_operator XYZ,>C,ICALL .END Only the first 6 language types will allow the Expand, Flow and Structure operations to be effective. This implies that you could not use all the features of Alpha for a new language which did not have the call/label syntax of one of the existing languages. The Alpha programme scans the keyword table in the order specified in the profile to the comment start in the record for a maximum of 16 found entries. A keyword_found array is created and the text is written by running down the array from the last to the first so if the entries in the profile were in the order :- PLS, END LOOP,GREEN,72 PLS, END,DARKCYAN,72 Then the 'END LOOP' would overwrite the 'END'; spaces are significant. Note for CICS users. -------------------- CICS users may browse/analyse CICS code by using CRUISE on VM to access the correct level of CICS and saying 'CRUISE ( NOMENU O212' etc. (or saying 'H:TEMP A Z TEMP.A37 {to copy the file on to the PS/2} If you have an HSXUPROF or HSXPROF on your A-disk {there is a default one on the Y-disk} with an entry for ALMCOPY e.g. hsx 'SET ACXFR56A ON ' hsx 'SET ACXFR54B ON ' Then issue 'HSXPROF ON' to load HSX on CMS, and ALMCOPY will unpack the file when transferring it to the PS/2 so you can omit the HSXMOVE step. The ISPCTOOL-200 disk should be accessed for ALMCOPY5 {the CMS side of ALMCOPY}. =================== End of ALPHA1.TXT ======================================